Optimal. Leaf size=230 \[ \frac {a^3 (5+2 n) \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n) (2+n)}+\frac {\sec ^{1+n}(e+f x) \left (a^3+a^3 \sec (e+f x)\right ) \sin (e+f x)}{f (2+n)}-\frac {a^3 (1+4 n) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right ) \sec ^{-1+n}(e+f x) \sin (e+f x)}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {a^3 (7+4 n) \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) \sec ^n(e+f x) \sin (e+f x)}{f n (2+n) \sqrt {\sin ^2(e+f x)}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.20, antiderivative size = 230, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 5, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {3899, 4082,
3872, 3857, 2722} \begin {gather*} -\frac {a^3 (4 n+1) \sin (e+f x) \sec ^{n-1}(e+f x) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right )}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {a^3 (4 n+7) \sin (e+f x) \sec ^n(e+f x) \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right )}{f n (n+2) \sqrt {\sin ^2(e+f x)}}+\frac {a^3 (2 n+5) \sin (e+f x) \sec ^{n+1}(e+f x)}{f (n+1) (n+2)}+\frac {\sin (e+f x) \left (a^3 \sec (e+f x)+a^3\right ) \sec ^{n+1}(e+f x)}{f (n+2)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2722
Rule 3857
Rule 3872
Rule 3899
Rule 4082
Rubi steps
\begin {align*} \int \sec ^n(e+f x) (a+a \sec (e+f x))^3 \, dx &=\frac {\sec ^{1+n}(e+f x) \left (a^3+a^3 \sec (e+f x)\right ) \sin (e+f x)}{f (2+n)}+\frac {a \int \sec ^n(e+f x) (a+a \sec (e+f x)) (a (2+2 n)+a (5+2 n) \sec (e+f x)) \, dx}{2+n}\\ &=\frac {a^3 (5+2 n) \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n) (2+n)}+\frac {\sec ^{1+n}(e+f x) \left (a^3+a^3 \sec (e+f x)\right ) \sin (e+f x)}{f (2+n)}+\frac {a \int \sec ^n(e+f x) \left (a^2 (2+n) (1+4 n)+a^2 (1+n) (7+4 n) \sec (e+f x)\right ) \, dx}{2+3 n+n^2}\\ &=\frac {a^3 (5+2 n) \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n) (2+n)}+\frac {\sec ^{1+n}(e+f x) \left (a^3+a^3 \sec (e+f x)\right ) \sin (e+f x)}{f (2+n)}+\frac {\left (a^3 (1+4 n)\right ) \int \sec ^n(e+f x) \, dx}{1+n}+\frac {\left (a^3 (7+4 n)\right ) \int \sec ^{1+n}(e+f x) \, dx}{2+n}\\ &=\frac {a^3 (5+2 n) \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n) (2+n)}+\frac {\sec ^{1+n}(e+f x) \left (a^3+a^3 \sec (e+f x)\right ) \sin (e+f x)}{f (2+n)}+\frac {\left (a^3 (1+4 n) \cos ^n(e+f x) \sec ^n(e+f x)\right ) \int \cos ^{-n}(e+f x) \, dx}{1+n}+\frac {\left (a^3 (7+4 n) \cos ^n(e+f x) \sec ^n(e+f x)\right ) \int \cos ^{-1-n}(e+f x) \, dx}{2+n}\\ &=\frac {a^3 (5+2 n) \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n) (2+n)}+\frac {\sec ^{1+n}(e+f x) \left (a^3+a^3 \sec (e+f x)\right ) \sin (e+f x)}{f (2+n)}-\frac {a^3 (1+4 n) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right ) \sec ^{-1+n}(e+f x) \sin (e+f x)}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {a^3 (7+4 n) \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) \sec ^n(e+f x) \sin (e+f x)}{f n (2+n) \sqrt {\sin ^2(e+f x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.52, size = 286, normalized size = 1.24 \begin {gather*} -\frac {i 2^{-3+n} a^3 \left (\frac {e^{i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^n (1+\cos (e+f x))^3 \left (\frac {8 e^{3 i (e+f x)} \, _2F_1\left (1,\frac {1}{2} (-1-n);\frac {5+n}{2};-e^{2 i (e+f x)}\right )}{\left (1+e^{2 i (e+f x)}\right )^2 (3+n)}+\frac {6 e^{i (e+f x)} \, _2F_1\left (1,\frac {1-n}{2};\frac {3+n}{2};-e^{2 i (e+f x)}\right )}{1+n}+\frac {\left (1+e^{2 i (e+f x)}\right ) \, _2F_1\left (1,1-\frac {n}{2};\frac {2+n}{2};-e^{2 i (e+f x)}\right )}{n}+\frac {12 e^{2 i (e+f x)} \, _2F_1\left (1,-\frac {n}{2};\frac {4+n}{2};-e^{2 i (e+f x)}\right )}{\left (1+e^{2 i (e+f x)}\right ) (2+n)}\right ) \sec ^6\left (\frac {1}{2} (e+f x)\right )}{f} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.07, size = 0, normalized size = 0.00 \[\int \left (\sec ^{n}\left (f x +e \right )\right ) \left (a +a \sec \left (f x +e \right )\right )^{3}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{3} \left (\int 3 \sec {\left (e + f x \right )} \sec ^{n}{\left (e + f x \right )}\, dx + \int 3 \sec ^{2}{\left (e + f x \right )} \sec ^{n}{\left (e + f x \right )}\, dx + \int \sec ^{3}{\left (e + f x \right )} \sec ^{n}{\left (e + f x \right )}\, dx + \int \sec ^{n}{\left (e + f x \right )}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int {\left (a+\frac {a}{\cos \left (e+f\,x\right )}\right )}^3\,{\left (\frac {1}{\cos \left (e+f\,x\right )}\right )}^n \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________